package com.yx.server.util;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;

@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
public class ResultUtil implements Serializable {

    private Integer number;
    private byte status;
    private Object message;
    private Object data;

    private ResultUtil() {
    }

    public static ResultUtil newInstance() {
        return new ResultUtil();
    }

    public Integer getNumber() {
        return number;
    }

    public ResultUtil setNumber(Integer number) {
        this.number = number;
        return this;
    }

    public byte getStatus() {
        return status;
    }

    public ResultUtil setStatus(byte status) {
        this.status = status;
        return this;
    }

    public Object getMessage() {
        return message;
    }

    public ResultUtil setMessage(Object message) {
        this.message = message;
        return this;
    }

    public Object getData() {
        return data;
    }

    public ResultUtil setData(Object data) {
        this.data = data;
        return this;
    }

    /**
     * 未登录
     */
    public static final byte UN_LOGIN = -3;
    /**
     * 权限不足
     */
    public static final byte DENIED = -2;
    /**
     * 系统出错
     */
    public static final byte ERROR = -1;

    /**
     * 操作成功
     */
    public static final byte SUCCESS = 0;
    /**
     * 重复提交
     */
    public static final byte REPEAT_SUBMIT = 1;
    /**
     * 操作失败,失败信息由message标识
     */
    public static final byte FAILED = 2;
    /**
     * 参数验证失败！
     */
    public static final byte PARAM_VALID_FAILED = 3;


    /**
     * 返回值成功
     */
    public static final int RETURN_SUCCESS= 200;
    /**
     * 返回值失败，数据错误
     */
    public static final int RETURN_VALUE_FAILED= 501;
    /**
     * 返回值失败，数据为null
     */
    public static final int RETURN_VALUE_NULL= 500;
    /**
     * 参数找不到
     */
    public static final int RETURN_VALID_MISS= 404;
    /**
     * 参数不完整
     */
    public static final int RETURN_VALID_LACK= 401;
    /**
     * 参数验证失败
     */
    public static final int RETURN_VALID_ERROR= 402;



    public static final String RESULT_STATUS = ResultUtil.class.getName() + ".STATUS";

}